package com.zfx.mapper;

import com.zfx.pojo.SecondarySystemPeopleMessage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @description:
 * @author: zfx
 * @version: 1.0
 * @time: 2020-05-12 19:17
 * <p>
 * 修改历史：
 * 修改日期      修改人员    版本    内容
 * 2020-05-12   zfx       1.0
 */
public interface ISecondarySystemPeopleMessageMapper extends Mapper<SecondarySystemPeopleMessage> {

    @Select("select j.* from tbs_secondary_system_job j " +
            "left join tbs_secondary_system f on j.secondarySystemId = f.secondarySystemId " +
            "where f.tableId = #{tableId} and f.typeId = #{typeId}")
    public List<SecondarySystemPeopleMessage> findByLevel1SystemIdAndTypeId(@Param(value = "tableId") int tableId, @Param(value = "typeId") int typeId);


    @Select("select secondarySystemId from tbs_secondary_system " +
            "where tableId = #{tableId} and typeId = #{typeId}")
    public String findSecondarySystemIdByLevel1SystemIdAndTypeId(@Param(value = "tableId") int tableId, @Param(value = "typeId") int typeId);


    @Select("delete j.* from tbs_secondary_system_job j " +
            "left join tbs_secondary_system f on j.secondarySystemId = f.secondarySystemId " +
            "where f.tableId = #{tableId} and f.typeId = #{typeId}")
    public void deleteByLevel1SystemIdAndTypeId(@Param(value = "tableId") int tableId, @Param(value = "typeId") int typeId);

}
